/*
 * Copyright 2020-2025 the original author or authors.
 * You cannot use this file unless authorized by the author.
 */
package org.ipig.commons.conf.kafka.producer;

import lombok.Data;
import lombok.ToString;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * kafka生产者配置
 *
 * @author <a href="mailto:comchnts@163.com">chinats</a>
 * @version $Id: KafkaProducerConf.java 3 2020-01-21 09:36:33Z ts <comchnts@163.com> $
 * @since 1.0
 */
@Data
@ToString
public class KafkaProducerConf implements Serializable {
    // topicName
    private String topicName = "";
    // 服务节点
    private String bootstrapServers = "";
    // ack方式，all，会等所有的commit最慢的方式
    private String acks = "0";
    // 失败是否重试，设置会有可能产生重复数据
    private String retries = "3";
    // 对于每个partition的batch buffer大小
    private String batchSize = "16384";
    // partition数量
    private String partition = "";
    // 等待时间 s
    private String lingerMs = "1";
    // 整个producer可以用于buffer的内存大小
    private String bufferMemory = "33554432";
    // key Serializer
    private String keySerializer = "org.apache.kafka.common.serialization.StringSerializer";
    // value Serializer
    private String valueSerializer = "org.apache.kafka.common.serialization.StringSerializer";
    //幂等发送
    private String enableIdempotence = "false";
    // 其它属性
    private Map<String, Object> props = new HashMap<>();
}